package com.maixy.studyonlineapi.exceptions;


import com.maixy.studyonlineapi.bean.State;
import com.maixy.studyonlineapi.constants.GlobalConstant;
import lombok.Getter;
import lombok.Setter;

/**
 * @ClassName UnknownException
 * @Description TODO
 * @Date 2020/5/3 10:58
 * @Author mai
 */
@Getter
@Setter
public class TipException extends RuntimeException {
    private int code;
    private String msg;

    public TipException() {
        this(GlobalConstant.StateCode.TIP_EXCEPTION);
    }

    public TipException(String msg) {
        this.msg = msg;
        this.code = GlobalConstant.StateCode.TIP_EXCEPTION.getCode();
    }

    public TipException(State state) {
        this.code = state.getCode();
        this.msg = state.getMsg();
    }


}
